<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>超市收银系统</title>
    <link type="text/css" rel="stylesheet" href="fontsawesome/css/font-awesome.css"/>
    <style type="text/css">
        .providerAdd{
            line-height: 50px;
            width: 99%;
            border: 1px solid #e0f0fd;
            margin: 0 5px;
            background-color: rgba(32, 163, 255, 0.18);
        }
        #upForm {
            line-height: 50px;
            width: 40%;
            height: 80%;
            margin:80px auto;
            background-color: rgba(32, 163, 255, 0.18);

        }
        .update {
            width: 80%;
            line-height: 45px;
            margin: 20px 32%;
            font-size: 22px;
            font-weight: bold;
        }
        .first {
            padding-top: 10%;
        }
        .update input {
            display: inline;
        }
        .update select {
            display: inline;
        }
        .providerAddBtn {
            margin-top: 40px;

        }
        .providerAddBtn input[type="button"]{
            width: 8%;

            font-size: 25px;
            background-color: rgba(10, 94, 182, 0.42);
        }
        .providerAddBtn input[value="保存"]{
            position:absolute;
            margin: 0;
            right:51%;
        }
        .providerAddBtn input[value="返回"]{
            position:absolute;
            margin: 0;
            right:41%;
        }
    </style>
</head>
<body>
        <div class="providerAdd">
            <form id="upForm" name="userForm" method="post" action="jsp/emp.do">
                <div class="update">
                    <span>用户账号：</span>
                    <input type="text" name="userName" id="userName" th:value="${empInfo?.userName}">
                </div>
                <div  class="update">
                    <span>用户密码：</span>
                    <input type="text" name="password" id="password" th:value="${empInfo?.password}">

                </div>
                <div class="update">
                    <span>用户姓名：</span>
                    <input type="text" name="realName" id="realName" th:value="${empInfo?.realName}">
                </div>

                <div class="update">
                    <span>用户性别：</span>

                        <select name="sex" id="sex">
                            <option value="1" th:selected="${empInfo?.sex == 1}">男</option>
                            <option value="0" th:selected="${empInfo?.sex == 0}">女</option>
                        </select>

                </div>
                <div class="update">用户角色：
                    <select name="roleId" id="roleId">
                        <option th:each="t,line : ${roleList}" th:value="${line.index}" th:text="${t.name}"
                                th:selected="${empInfo?.roleId == line.index}"></option>
                    </select>
                </div>
                <div class="update">
                    <span>用户工资：</span>
                    <input  type="text" name="salary" id="salary"  th:value="${empInfo?.salary}">
                </div>
                <div class="providerAddBtn">
                    <input type="button" name="add"  value="保存" >
                    <input type="button" name="back" value="返回" >
                </div>
            </form>
        </div>
</body>
<script src="/js/jquery-2.2.1.min.js"></script>
<script src="/js/jump.js"></script>
<script type="text/javascript" th:inline="javascript">
    $(".providerAddBtn :button[value='保存']").bind("click", function() {
        alert($("#upForm").serialize());
        if(!confirm("确定保存吗?")) return;
        location = "/emp/modify?"+$("#upForm").serialize()+"&id="+empInfo.id
    });
   /* $(".providerAddBtn :button[value='返回']").bind("click", function() {
        toJump([[${#session.getAttribute("prevUrl")}]], [[${#session.getAttribute("prevParam")}]]);
    });*/
    $(".providerAddBtn :button[value='返回']").bind("click", function() {
        location = "/emp/query?"
    });
</script>
</html>